
import * as fetch from 'isomorphic-fetch';
import * as toString from 'stream-to-string';
import { TextDecoder } from 'text-encoding';

export async function request(url: RequestInfo, options?: RequestInit) {
  const req = await fetch(url, options);
  const body = await req.body.getReader().read();
  const json = new TextDecoder('utf-8').decode(body.value);
  const files = JSON.parse(json);
  return files;
}
